What is the following number if written out the usual way: 1.9345E+03
1934.5
Consider writing the value 1/3 out in decimal notation:
0.333333333333333333
There is no limit to the number of 3's required for complete accuracy.
With the float
data type, there are only 32 bits.
This cannot represent an unlimited number of 3's.
The data type float
has 23 bits of precision.
(The rest of the bits are used to indicate the sign and
size of the number.)
This is equivalent to only about 7 decimal places.
The number of places of precision for float
is the same no matter what the
size of the number.
Data type float
can represent numbers as big as about
3.4E+38.
But the precision of these large numbers will also be
about 7 decimal digits.
Remember: data type float
has about the
range and precision of a cheap electronic calculator.
This is usually not sufficient.
What is wrong with the following constant, expected to be of type float
?
1230.00089F